home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / CIncludes / CardServices.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-23  |  29.8 KB  |  790 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        CardServices.h
  3.  
  4.     Contains:    This file contains constants and data structures that describe
  5.                 the client interface to Card and Socket Services.
  6.  
  7.      Version:    Technology: PCMCIA Software 2.0
  8.                 Package:    Universal Interfaces 2.1.1 in “MPW Latest” on ETO #19
  9.  
  10.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  11.                  All rights reserved.
  12.  
  13.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  14.                  stack.  Include the file and version information (from above)
  15.                  in the problem description and send to:
  16.                      Internet:    apple.bugs@applelink.apple.com
  17.                      AppleLink:    APPLE.BUGS
  18.   
  19. */
  20.  
  21. #ifndef __CARDSERVICES__
  22. #define __CARDSERVICES__
  23.  
  24.  
  25. #ifndef __TYPES__
  26. #include <Types.h>
  27. #endif
  28. /*    #include <ConditionalMacros.h>                                */
  29.  
  30. #ifndef __PCCARDTUPLES__
  31. #include <PCCardTuples.h>
  32. #endif
  33.  
  34. #ifndef __MIXEDMODE__
  35. #include <MixedMode.h>
  36. #endif
  37.  
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41.  
  42. #if PRAGMA_ALIGN_SUPPORTED
  43. #pragma options align=mac68k
  44. #endif
  45.  
  46. #if PRAGMA_IMPORT_SUPPORTED
  47. #pragma import on
  48. #endif
  49.  
  50.  
  51. enum {
  52.     CS_MAX_SOCKETS                = 32                            /* a long is used as a socket bitmap*/
  53. };
  54.  
  55. /* ••• Should eventually move to <Gestalt.h>*/
  56. enum {
  57.     gestaltCardServicesAttr        = 'pccd',                        /* Card Services attributes*/
  58.     gestaltCardServicesPresent    = 0                                /* if set, Card Services is present*/
  59. };
  60.  
  61. /* ••• Should eventually move to <Traps.h>*/
  62. enum {
  63.     _PCCardDispatch                = 0xAAF0                        /* Card Services entry trap*/
  64. };
  65.  
  66. /* 
  67.     The PC Card Manager will migrate towards a complete Mac name space very soon.
  68.     Part of that process will be to reassign result codes to a range reserved for
  69.     the PC Card Manager...the range will be...-9050 to -9305 (decimal inclusive).
  70. */
  71. /*    result codes*/
  72. enum {
  73.     kCSBadAdapterErr            = -9050,                        /* invalid adapter number*/
  74.     kCSBadAttributeErr            = -9051,                        /* specified attributes field value is invalid*/
  75.     kCSBadBaseErr                = -9052,                        /* specified base system memory address is invalid*/
  76.     kCSBadEDCErr                = -9053,                        /* specified EDC generator specified is invalid*/
  77.     kCSBadIRQErr                = -9054,                        /* specified IRQ level is invalid*/
  78.     kCSBadOffsetErr                = -9055,                        /* specified PC card memory array offset is invalid*/
  79.     kCSBadPageErr                = -9056,                        /* specified page is invalid*/
  80.     kCSBadSizeErr                = -9057,                        /* specified size is invalid*/
  81.     kCSBadSocketErr                = -9058,                        /* specified logical or physical socket number is invalid*/
  82.     kCSBadTypeErr                = -9059,                        /* specified window or interface type is invalid*/
  83.     kCSBadVccErr                = -9060,                        /* specified Vcc power level index is invalid*/
  84.     kCSBadVppErr                = -9061,                        /* specified Vpp1 or Vpp2 power level index is invalid*/
  85.     kCSBadWindowErr                = -9062,                        /* specified window is invalid*/
  86.     kCSBadArgLengthErr            = -9063,                        /* ArgLength argument is invalid*/
  87.     kCSBadArgsErr                = -9064,                        /* values in argument packet are invalid*/
  88.     kCSBadHandleErr                = -9065,                        /* clientHandle is invalid*/
  89.     kCSBadCISErr                = -9066,                        /* CIS on card is invalid*/
  90.     kCSBadSpeedErr                = -9067,                        /* specified speed is unavailable*/
  91.     kCSReadFailureErr            = -9068,                        /* unable to complete read request*/
  92.     kCSWriteFailureErr            = -9069,                        /* unable to complete write request*/
  93.     kCSGeneralFailureErr        = -9070,                        /* an undefined error has occurred*/
  94.     kCSNoCardErr                = -9071,                        /* no PC card in the socket*/
  95.     kCSUnsupportedFunctionErr    = -9072,                        /* function is not supported by this implementation*/
  96.     kCSUnsupportedModeErr        = -9073,                        /* mode is not supported*/
  97.     kCSBusyErr                    = -9074,                        /* unable to process request at this time - try later*/
  98.     kCSWriteProtectedErr        = -9075,                        /* media is write-protected*/
  99.     kCSConfigurationLockedErr    = -9076,                        /* a configuration has already been locked*/
  100.     kCSInUseErr                    = -9077,                        /* requested resource is being used by a client*/
  101.     kCSNoMoreItemsErr            = -9078,                        /* there are no more of the requested item*/
  102.     kCSOutOfResourceErr            = -9079                            /* Card Services has exhausted the resource*/
  103. };
  104.  
  105. /*    messages sent to client's event handler*/
  106. enum {
  107.     kCSNullMessage                = 0x00,                            /* no messages pending (not sent to clients)*/
  108.     kCSCardInsertionMessage        = 0x01,                            /* card has been inserted into the socket*/
  109.     kCSCardRemovalMessage        = 0x02,                            /* card has been removed from the socket*/
  110.     kCSCardLockMessage            = 0x03,                            /* card is locked into the socket with a mechanical latch*/
  111.     kCSCardUnlockMessage        = 0x04,                            /* card is no longer locked into the socket*/
  112.     kCSCardReadyMessage            = 0x05,                            /* card is ready to be accessed*/
  113.     kCSCardResetMessage            = 0x06,                            /* physical reset has completed*/
  114.     kCSInsertionRequestMessage    = 0x07,                            /* request to insert a card using insertion motor*/
  115.     kCSInsertionCompleteMessage    = 0x08,                            /* insertion motor has finished inserting a card*/
  116.     kCSEjectionRequestMessage    = 0x09,                            /* user or other client is requesting a card ejection*/
  117.     kCSEjectionFailedMessage    = 0x0A,                            /* eject failure due to electrical/mechanical problems*/
  118.     kCSPMResumeMessage            = 0x0B,                            /* power management resume (TBD)*/
  119.     kCSPMSuspendMessage            = 0x0C,                            /* power management suspend (TBD)*/
  120.     kCSResetPhysicalMessage        = 0x0D,                            /* physical reset is about to occur on this card*/
  121.     kCSResetRequestMessage        = 0x0E,                            /* physical reset has been requested by a client*/
  122.     kCSResetCompleteMessage        = 0x0F,                            /* ResetCard() background reset has completed*/
  123.     kCSBatteryDeadMessage        = 0x10,                            /* battery is no longer useable, data will be lost*/
  124.     kCSBatteryLowMessage        = 0x11,                            /* battery is weak and should be replaced*/
  125.     kCSWriteProtectMessage        = 0x12,                            /* card is now write protected*/
  126.     kCSWriteEnabledMessage        = 0x13,                            /* card is now write enabled*/
  127.     kCSClientInfoMessage        = 0x14,                            /* client is to return client information*/
  128.     kCSSSUpdatedMessage            = 0x15,                            /* AddSocketServices/ReplaceSocket services has changed SS support*/
  129.     kCSFunctionInterruptMessage    = 0x16,                            /* card function interrupt*/
  130.     kCSAccessErrorMessage        = 0x17,                            /* client bus errored on access to socket*/
  131.     kCSCardUnconfiguredMessage    = 0x18,                            /* a CARD_READY was delivered to all clients and no client */
  132. /*    requested a configuration for the socket*/
  133.     kCSStatusChangedMessage        = 0x19                            /* status change for cards in I/O mode*/
  134. };
  135.  
  136. /*
  137.     The following is a mapping of the PCMCIA name space to the Macintosh name space.
  138.     These two enum lists will be removed and given to developers as a separate file.
  139. */
  140. enum {
  141.     SUCCESS                        = noErr,
  142.     BAD_ADAPTER                    = kCSBadAdapterErr,
  143.     BAD_ATTRIBUTE                = kCSBadAttributeErr,
  144.     BAD_BASE                    = kCSBadBaseErr,
  145.     BAD_EDC                        = kCSBadEDCErr,
  146.     BAD_IRQ                        = kCSBadIRQErr,
  147.     BAD_OFFSET                    = kCSBadOffsetErr,
  148.     BAD_PAGE                    = kCSBadPageErr,
  149.     BAD_SIZE                    = kCSBadSizeErr,
  150.     BAD_SOCKET                    = kCSBadSocketErr,
  151.     BAD_TYPE                    = kCSBadTypeErr,
  152.     BAD_VCC                        = kCSBadVccErr,
  153.     BAD_VPP                        = kCSBadVppErr,
  154.     BAD_WINDOW                    = kCSBadWindowErr,
  155.     BAD_ARG_LENGTH                = kCSBadArgLengthErr,
  156.     BAD_ARGS                    = kCSBadArgsErr,
  157.     BAD_HANDLE                    = kCSBadHandleErr,
  158.     BAD_CIS                        = kCSBadCISErr,
  159.     BAD_SPEED                    = kCSBadSpeedErr,
  160.     READ_FAILURE                = kCSReadFailureErr,
  161.     WRITE_FAILURE                = kCSWriteFailureErr,
  162.     GENERAL_FAILURE                = kCSGeneralFailureErr,
  163.     NO_CARD                        = kCSNoCardErr,
  164.     UNSUPPORTED_FUNCTION        = kCSUnsupportedFunctionErr,
  165.     UNSUPPORTED_MODE            = kCSUnsupportedModeErr,
  166.     BUSY                        = kCSBusyErr,
  167.     WRITE_PROTECTED                = kCSWriteProtectedErr,
  168.     CONFIGURATION_LOCKED        = kCSConfigurationLockedErr,
  169.     IN_USE                        = kCSInUseErr,
  170.     NO_MORE_ITEMS                = kCSNoMoreItemsErr,
  171.     OUT_OF_RESOURCE                = kCSOutOfResourceErr
  172. };
  173.  
  174. /*    messages sent to client's event handler*/
  175. enum {
  176.     NULL_MESSAGE                = kCSNullMessage,
  177.     CARD_INSERTION                = kCSCardInsertionMessage,
  178.     CARD_REMOVAL                = kCSCardRemovalMessage,
  179.     CARD_LOCK                    = kCSCardLockMessage,
  180.     CARD_UNLOCK                    = kCSCardUnlockMessage,
  181.     CARD_READY                    = kCSCardReadyMessage,
  182.     CARD_RESET                    = kCSCardResetMessage,
  183.     INSERTION_REQUEST            = kCSInsertionRequestMessage,
  184.     INSERTION_COMPLETE            = kCSInsertionCompleteMessage,
  185.     EJECTION_REQUEST            = kCSEjectionRequestMessage,
  186.     EJECTION_FAILED                = kCSEjectionFailedMessage,
  187.     PM_RESUME                    = kCSPMResumeMessage,
  188.     PM_SUSPEND                    = kCSPMSuspendMessage,
  189.     RESET_PHYSICAL                = kCSResetPhysicalMessage,
  190.     RESET_REQUEST                = kCSResetRequestMessage,
  191.     RESET_COMPLETE                = kCSResetCompleteMessage,
  192.     BATTERY_DEAD                = kCSBatteryDeadMessage,
  193.     BATTERY_LOW                    = kCSBatteryLowMessage,
  194.     WRITE_PROTECT                = kCSWriteProtectMessage,
  195.     WRITE_ENABLED                = kCSWriteEnabledMessage,
  196.     CLIENT_INFO                    = kCSClientInfoMessage,
  197.     SS_UPDATED                    = kCSSSUpdatedMessage,
  198.     FUNCTION_INTERRUPT            = kCSFunctionInterruptMessage,
  199.     ACCESS_ERROR                = kCSAccessErrorMessage,
  200.     CARD_UNCONFIGURED            = kCSCardUnconfiguredMessage,
  201.     STATUS_CHANGED                = kCSStatusChangedMessage
  202. };
  203.  
  204. /*----------------        CSAccessConfigurationRegister    ----------------*/
  205. typedef struct AccessConfigurationRegisterPB AccessConfigurationRegisterPB;
  206.  
  207. struct AccessConfigurationRegisterPB {
  208.     UInt16                            socket;                        /*  -> global socket number*/
  209.     UInt8                            action;                        /*  -> read/write*/
  210.     UInt8                            offset;                        /*  -> offset from config register base*/
  211.     UInt8                            value;                        /* <-> value to read/write*/
  212.     UInt8                            padding[1];                    /* */
  213. };
  214. /*    ‘action’ field values*/
  215.  
  216. enum {
  217.     kCSReadConfigRegister        = 0x00,
  218.     kCSWriteConfigRegister        = 0x01
  219. };
  220.  
  221. /*----------------        CSGetCardServicesInfo            ----------------*/
  222. typedef struct GetCardServicesInfoPB GetCardServicesInfoPB;
  223.  
  224. struct GetCardServicesInfoPB {
  225.     UInt8                            signature[2];                /* <-  two ascii chars 'CS'*/
  226.     UInt16                            count;                        /* <-  total number of sockets installed*/
  227.     UInt16                            revision;                    /* <-  BCD*/
  228.     UInt16                            csLevel;                    /* <-  BCD*/
  229.     UInt16                            reserved;                    /*  -> zero*/
  230.     UInt16                            vStrLen;                    /* <-> in: client's buffer size, out: vendor string length*/
  231.     UInt8                            *vendorString;                /* <-> in: pointer to buffer to hold CS vendor string (zero-terminated)*/
  232. /*      out: CS vendor string copied to buffer*/
  233. };
  234. /*----------------        CSGetClientInfo                    ----------------*/
  235. typedef struct ClientInfoParam ClientInfoParam;
  236.  
  237. struct ClientInfoParam {
  238.     UInt32                            clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  239.     UInt16                            attributes;                    /* <-> subfunction + bitmapped client attributes*/
  240.     UInt16                            revision;                    /* <-  BCD value of client's revision*/
  241.     UInt16                            csLevel;                    /* <-  BCD value of CS release*/
  242.     UInt16                            revDate;                    /* <-  revision date: y[15-9], m[8-5], d[4-0]*/
  243.     SInt16                            nameLen;                    /* <-> in: max length of client name string, out: actual length*/
  244.     SInt16                            vStringLen;                    /* <-> in: max length of vendor string, out: actual length*/
  245.     UInt8                            *nameString;                /* <-  pointer to client name string (zero-terminated)*/
  246.     UInt8                            *vendorString;                /* <-  pointer to vendor string (zero-terminated)*/
  247. };
  248. /* upper byte of attributes is kCSCardNameSubfunction,*/
  249. /*                               kCSCardTypeSubfunction,*/
  250. /*                               kCSHelpStringSubfunction*/
  251. typedef struct AlternateTextStringParam AlternateTextStringParam;
  252.  
  253. struct AlternateTextStringParam {
  254.     UInt32                            clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  255.     UInt16                            attributes;                    /* <-> subfunction + bitmapped client attributes*/
  256.     UInt16                            socket;                        /*  -> logical socket number*/
  257.     UInt16                            reserved;                    /*  -> zero*/
  258.     SInt16                            length;                        /* <-> in: max length of string, out: actual length*/
  259.     UInt8                            *text;                        /* <-  pointer to string (zero-terminated)*/
  260. };
  261. /* upper byte of attributes is kCSCardIconSubfunction*/
  262. typedef struct AlternateCardIconParam AlternateCardIconParam;
  263.  
  264. struct AlternateCardIconParam {
  265.     UInt32                            clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  266.     UInt16                            attributes;                    /* <-> subfunction + bitmapped client attributes*/
  267.     UInt16                            socket;                        /*  -> logical socket number*/
  268.     Handle                            iconSuite;                    /* <-  handle to icon suite containing all icons*/
  269. };
  270. /* upper byte of attributes is kCSActionProcSubfunction*/
  271. typedef struct CustomActionProcParam CustomActionProcParam;
  272.  
  273. struct CustomActionProcParam {
  274.     UInt32                            clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  275.     UInt16                            attributes;                    /* <-> subfunction + bitmapped client attributes*/
  276.     UInt16                            socket;                        /*  -> logical socket number*/
  277. };
  278. typedef struct GetClientInfoPB GetClientInfoPB;
  279.  
  280. struct GetClientInfoPB {
  281.     union {
  282.         ClientInfoParam                    clientInfo;
  283.         AlternateTextStringParam        alternateTextString;
  284.         AlternateCardIconParam            alternateIcon;
  285.         CustomActionProcParam            customActionProc;
  286.     }                                u;
  287. };
  288. /*    ‘attributes’ field values*/
  289.  
  290. enum {
  291.     kCSMemoryClient                = 0x0001,
  292.     kCSIOClient                    = 0x0004,
  293.     kCSClientTypeMask            = 0x0007,
  294.     kCSShareableCardInsertEvents = 0x0008,
  295.     kCSExclusiveCardInsertEvents = 0x0010,
  296.     kCSInfoSubfunctionMask        = 0xFF00,
  297.     kCSClientInfoSubfunction    = 0x0000,
  298.     kCSCardNameSubfunction        = 0x8000,
  299.     kCSCardTypeSubfunction        = 0x8100,
  300.     kCSHelpStringSubfunction    = 0x8200,
  301.     kCSCardIconSubfunction        = 0x8300,
  302.     kCSActionProcSubfunction    = 0x8400
  303. };
  304.  
  305. /*----------------        CSGetConfigurationInfo            ----------------*/
  306. /*----------------        CSModifyConfiguration            ----------------*/
  307. /*----------------        CSRequestConfiguration            ----------------*/
  308. typedef struct GetModRequestConfigInfoPB GetModRequestConfigInfoPB;
  309.  
  310. struct GetModRequestConfigInfoPB {
  311.     UInt32                            clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  312.     UInt16                            socket;                        /*  -> logical socket number*/
  313.     UInt16                            attributes;                    /* <-> bitmap of configuration attributes*/
  314.     UInt8                            vcc;                        /* <-> Vcc setting*/
  315.     UInt8                            vpp1;                        /* <-> Vpp1 setting*/
  316.     UInt8                            vpp2;                        /* <-> Vpp2 setting*/
  317.     UInt8                            intType;                    /* <-> interface type (memory or memory+I/O)*/
  318.     UInt32                            configBase;                    /* <-> card base address of configuration registers*/
  319.     UInt8                            status;                        /* <-> card status register setting, if present*/
  320.     UInt8                            pin;                        /* <-> card pin register setting, if present*/
  321.     UInt8                            copy;                        /* <-> card socket/copy register setting, if present*/
  322.     UInt8                            configIndex;                /* <-> card option register setting, if present*/
  323.     UInt8                            present;                    /* <-> bitmap of which configuration registers are present*/
  324.     UInt8                            firstDevType;                /* <-  from DeviceID tuple*/
  325.     UInt8                            funcCode;                    /* <-  from FuncID tuple*/
  326.     UInt8                            sysInitMask;                /* <-  from FuncID tuple*/
  327.     UInt16                            manufCode;                    /* <-  from ManufacturerID tuple*/
  328.     UInt16                            manufInfo;                    /* <-  from ManufacturerID tuple*/
  329.     UInt8                            cardValues;                    /* <-  valid card register values*/
  330.     UInt8                            padding[1];                    /* */
  331. };
  332. /*    ‘attributes’ field values*/
  333.  
  334. enum {
  335.     kCSExclusivelyUsed            = 0x0001,
  336.     kCSEnableIREQs                = 0x0002,
  337.     kCSVccChangeValid            = 0x0004,
  338.     kCSVpp1ChangeValid            = 0x0008,
  339.     kCSVpp2ChangeValid            = 0x0010,
  340.     kCSValidClient                = 0x0020,
  341.     kCSSleepPower                = 0x0040,                        /* request that power be applied to socket during Sleep*/
  342.     kCSLockSocket                = 0x0080,
  343.     kCSTurnOnInUse                = 0x0100
  344. };
  345.  
  346. /*    ‘intType’ field values*/
  347. enum {
  348.     kCSMemoryInterface            = 0x01,
  349.     kCSMemory_And_IO_Interface    = 0x02
  350. };
  351.  
  352. /*    ‘present’ field values*/
  353. enum {
  354.     kCSOptionRegisterPresent    = 0x01,
  355.     kCSStatusRegisterPresent    = 0x02,
  356.     kCSPinReplacementRegisterPresent = 0x04,
  357.     kCSCopyRegisterPresent        = 0x08
  358. };
  359.  
  360. /*    ‘cardValues’ field values*/
  361. enum {
  362.     kCSOptionValueValid            = 0x01,
  363.     kCSStatusValueValid            = 0x02,
  364.     kCSPinReplacementValueValid    = 0x04,
  365.     kCSCopyValueValid            = 0x08
  366. };
  367.  
  368. /*----------------        CSGetClientEventMask            ----------------*/
  369. /*----------------        CSSetClientEventMask            ----------------*/
  370. typedef struct GetSetClientEventMaskPB GetSetClientEventMaskPB;
  371.  
  372. struct GetSetClientEventMaskPB {
  373.     UInt32                            clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  374.     UInt16                            attributes;                    /* <-> bitmap of attributes*/
  375.     UInt16                            eventMask;                    /* <-> bitmap of events to be passed to client for this socket*/
  376.     UInt16                            socket;                        /*  -> logical socket number*/
  377. };
  378. /*    ‘attributes’ field values*/
  379.  
  380. enum {
  381.     kCSEventMaskThisSocketOnly    = 0x0001
  382. };
  383.  
  384. /*    ‘eventMask’ field values*/
  385. enum {
  386.     kCSWriteProtectEvent        = 0x0001,
  387.     kCSCardLockChangeEvent        = 0x0002,
  388.     kCSEjectRequestEvent        = 0x0004,
  389.     kCSInsertRequestEvent        = 0x0008,
  390.     kCSBatteryDeadEvent            = 0x0010,
  391.     kCSBatteryLowEvent            = 0x0020,
  392.     kCSReadyChangeEvent            = 0x0040,
  393.     kCSCardDetectChangeEvent    = 0x0080,
  394.     kCSPMChangeEvent            = 0x0100,
  395.     kCSResetEvent                = 0x0200,
  396.     kCSSSUpdateEvent            = 0x0400,
  397.     kCSFunctionInterrupt        = 0x0800,
  398.     kCSAllEvents                = 0xFFFF
  399. };
  400.  
  401. /*----------------        CSGetFirstClient                ----------------*/
  402. /*----------------        CSGetNextClient                    ----------------*/
  403. typedef struct GetClientPB GetClientPB;
  404.  
  405. struct GetClientPB {
  406.     UInt32                            clientHandle;                /* <-  clientHandle for this client*/
  407.     UInt16                            socket;                        /*  -> logical socket number*/
  408.     UInt16                            attributes;                    /*  -> bitmap of attributes*/
  409. };
  410. /*    ‘attributes’ field values*/
  411.  
  412. enum {
  413.     kCSClientsForAllSockets        = 0x0000,
  414.     kCSClientsThisSocketOnly    = 0x0001
  415. };
  416.  
  417. /*----------------        CSGetFirstTuple                    ----------------*/
  418. /*----------------        CSGetNextTuple                    ----------------*/
  419. /*----------------        CSGetTupleData                    ----------------*/
  420. typedef struct GetTuplePB GetTuplePB;
  421.  
  422. struct GetTuplePB {
  423.     UInt16                            socket;                        /*  -> logical socket number*/
  424.     UInt16                            attributes;                    /*  -> bitmap of attributes*/
  425.     UInt8                            desiredTuple;                /*  -> desired tuple code value, or $FF for all*/
  426.     UInt8                            tupleOffset;                /*  -> offset into tuple from link byte*/
  427.     UInt16                            flags;                        /* <-> internal use*/
  428.     UInt32                            linkOffset;                    /* <-> internal use*/
  429.     UInt32                            cisOffset;                    /* <-> internal use*/
  430.     union {
  431.         struct {
  432.             UInt8                            tupleCode;            /* <-  tuple code found*/
  433.             UInt8                            tupleLink;            /* <-  link value for tuple found*/
  434.         }                                TuplePB;
  435.         struct {
  436.             UInt16                            tupleDataMax;        /*  -> maximum size of tuple data area*/
  437.             UInt16                            tupleDataLen;        /* <-  number of bytes in tuple body*/
  438.             TupleBody                        tupleData;            /* <-  tuple data*/
  439.         }                                TupleDataPB;
  440.     }                                u;
  441. };
  442. /*    ‘attributes’ field values*/
  443.  
  444. enum {
  445.     kCSReturnLinkTuples            = 0x0001
  446. };
  447.  
  448. /*----------------        CSRequestSocketMask                ----------------*/
  449. /*----------------        CSReleaseSocketMask                ----------------*/
  450. typedef struct ReqRelSocketMaskPB ReqRelSocketMaskPB;
  451.  
  452. struct ReqRelSocketMaskPB {
  453.     UInt32                            clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  454.     UInt16                            socket;                        /*  -> logical socket*/
  455.     UInt16                            eventMask;                    /*  -> bitmap of events to be passed to client for this socket*/
  456. };
  457. /*    ‘eventMask’ field values (see above for Get/SetClientEventMask*/
  458. /*----------------        CSGetStatus                        ----------------*/
  459. typedef struct GetStatusPB GetStatusPB;
  460.  
  461. struct GetStatusPB {
  462.     UInt16                            socket;                        /*  -> logical socket number*/
  463.     UInt16                            cardState;                    /* <-  current state of installed card*/
  464.     UInt16                            socketState;                /* <-  current state of the socket*/
  465. };
  466. /*    ‘cardState’ field values*/
  467.  
  468. enum {
  469.     kCSWriteProtected            = 0x0001,
  470.     kCSCardLocked                = 0x0002,
  471.     kCSEjectRequest                = 0x0004,
  472.     kCSInsertRequest            = 0x0008,
  473.     kCSBatteryDead                = 0x0010,
  474.     kCSBatteryLow                = 0x0020,
  475.     kCSReady                    = 0x0040,
  476.     kCSCardDetected                = 0x0080
  477. };
  478.  
  479. /*    ‘socketState’ field values*/
  480. enum {
  481.     kCSWriteProtectChanged        = 0x0001,
  482.     kCSCardLockChanged            = 0x0002,
  483.     kCSEjectRequestPending        = 0x0004,
  484.     kCSInsertRequestPending        = 0x0008,
  485.     kCSBatteryDeadChanged        = 0x0010,
  486.     kCSBatteryLowChanged        = 0x0020,
  487.     kCSReadyChanged                = 0x0040,
  488.     kCSCardDetectChanged        = 0x0080
  489. };
  490.  
  491. /*----------------        CSModifyWindow                    ----------------*/
  492. /*----------------        CSReleaseWindow                    ----------------*/
  493. /*----------------        CSRequestWindow                    ----------------*/
  494. typedef struct ReqModRelWindowPB ReqModRelWindowPB;
  495.  
  496. struct ReqModRelWindowPB {
  497.     UInt32                            clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  498.     UInt32                            windowHandle;                /* <-> window descriptor*/
  499.     UInt16                            socket;                        /*  -> logical socket number*/
  500.     UInt16                            attributes;                    /*  -> window attributes (bitmap)*/
  501.     UInt32                            base;                        /* <-> system base address*/
  502.     UInt32                            size;                        /* <-> memory window size*/
  503.     UInt8                            accessSpeed;                /*  -> window access speed (bitmap)*/
  504. /*        (not applicable for I/O mode)*/
  505.     UInt8                            padding[1];                    /* */
  506. };
  507. /*    ‘attributes’ field values*/
  508.  
  509. enum {
  510.     kCSMemoryWindow                = 0x0001,
  511.     kCSIOWindow                    = 0x0002,
  512.     kCSAttributeWindow            = 0x0004,                        /* not normally used by Card Services clients*/
  513.     kCSWindowTypeMask            = 0x0007,
  514.     kCSEnableWindow                = 0x0008,
  515.     kCSAccessSpeedValid            = 0x0010,
  516.     kCSLittleEndian                = 0x0020,                        /* configure socket for little endianess*/
  517.     kCS16BitDataPath            = 0x0040,                        /**/
  518.     kCSWindowPaged                = 0x0080,                        /* */
  519.     kCSWindowShared                = 0x0100,                        /**/
  520.     kCSWindowFirstShared        = 0x0200,                        /* */
  521.     kCSWindowProgrammable        = 0x0400                        /* */
  522. };
  523.  
  524. /*    ‘accessSpeed’ field values*/
  525. enum {
  526.     kCSDeviceSpeedCodeMask        = 0x07,
  527.     kCSSpeedExponentMask        = 0x07,
  528.     kCSSpeedMantissaMask        = 0x78,
  529.     kCSUseWait                    = 0x80,
  530.     kCSAccessSpeed250nsec        = 0x01,
  531.     kCSAccessSpeed200nsec        = 0x02,
  532.     kCSAccessSpeed150nsec        = 0x03,
  533.     kCSAccessSpeed100nsec        = 0x04,
  534.     kCSExtAccSpeedMant1pt0        = 0x01,
  535.     kCSExtAccSpeedMant1pt2        = 0x02,
  536.     kCSExtAccSpeedMant1pt3        = 0x03,
  537.     kCSExtAccSpeedMant1pt5        = 0x04,
  538.     kCSExtAccSpeedMant2pt0        = 0x05,
  539.     kCSExtAccSpeedMant2pt5        = 0x06,
  540.     kCSExtAccSpeedMant3pt0        = 0x07,
  541.     kCSExtAccSpeedMant3pt5        = 0x08,
  542.     kCSExtAccSpeedMant4pt0        = 0x09,
  543.     kCSExtAccSpeedMant4pt5        = 0x0A,
  544.     kCSExtAccSpeedMant5pt0        = 0x0B,
  545.     kCSExtAccSpeedMant5pt5        = 0x0C,
  546.     kCSExtAccSpeedMant6pt0        = 0x0D,
  547.     kCSExtAccSpeedMant7pt0        = 0x0E,
  548.     kCSExtAccSpeedMant8pt0        = 0x0F,
  549.     kCSExtAccSpeedExp1ns        = 0x00,
  550.     kCSExtAccSpeedExp10ns        = 0x01,
  551.     kCSExtAccSpeedExp100ns        = 0x02,
  552.     kCSExtAccSpeedExp1us        = 0x03,
  553.     kCSExtAccSpeedExp10us        = 0x04,
  554.     kCSExtAccSpeedExp100us        = 0x05,
  555.     kCSExtAccSpeedExp1ms        = 0x06,
  556.     kCSExtAccSpeedExp10ms        = 0x07
  557. };
  558.  
  559. /*----------------        CSRegisterClient                ----------------*/
  560. /*----------------        CSDeregisterClient                ----------------*/
  561. typedef struct ClientCallbackPB ClientCallbackPB;
  562.  
  563. struct ClientCallbackPB {
  564.     UInt16                            message;                    /*  -> which event this is*/
  565.     UInt16                            socket;                        /*  -> logical socket number*/
  566.     UInt16                            info;                        /*  -> function-specific*/
  567.     UInt16                            misc;                        /*  -> function-specific*/
  568.     Ptr                                reserved;                    /*  -> pointer to MTD request block*/
  569.     Ptr                                buffer;                        /*  -> function-specific*/
  570.     Ptr                                clientData;                    /*  -> pointer to client's data (from RegisterClient)*/
  571. };
  572. typedef ClientCallbackPB *ClientCallbackPBPtr;
  573.  
  574. typedef pascal UInt16 (*PCCardCSClientProcPtr)(ClientCallbackPBPtr ccPBPtr);
  575.  
  576. #if GENERATINGCFM
  577. typedef UniversalProcPtr PCCardCSClientUPP;
  578. #else
  579. typedef PCCardCSClientProcPtr PCCardCSClientUPP;
  580. #endif
  581.  
  582. enum {
  583.     uppPCCardCSClientProcInfo = kPascalStackBased
  584.          | RESULT_SIZE(SIZE_CODE(sizeof(UInt16)))
  585.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ClientCallbackPBPtr)))
  586. };
  587.  
  588. #if GENERATINGCFM
  589. #define NewPCCardCSClientProc(userRoutine)        \
  590.         (PCCardCSClientUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppPCCardCSClientProcInfo, GetCurrentArchitecture())
  591. #else
  592. #define NewPCCardCSClientProc(userRoutine)        \
  593.         ((PCCardCSClientUPP) (userRoutine))
  594. #endif
  595.  
  596. #if GENERATINGCFM
  597. #define CallPCCardCSClientProc(userRoutine, ccPBPtr)        \
  598.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppPCCardCSClientProcInfo, (ccPBPtr))
  599. #else
  600. #define CallPCCardCSClientProc(userRoutine, ccPBPtr)        \
  601.         (*(userRoutine))((ccPBPtr))
  602. #endif
  603.  
  604. typedef struct RegisterClientPB RegisterClientPB;
  605.  
  606. struct RegisterClientPB {
  607.     UInt32                            clientHandle;                /* <-  client descriptor*/
  608.     PCCardCSClientUPP                clientEntry;                /*  -> universal procPtr to client's event handler*/
  609.     UInt16                            attributes;                    /*  -> bitmap of client attributes*/
  610.     UInt16                            eventMask;                    /*  -> bitmap of events to notify client*/
  611.     Ptr                                clientData;                    /*  -> pointer to client's data*/
  612.     UInt16                            version;                    /*  -> Card Services version this client expects*/
  613. };
  614. /*    ‘attributes’ field values (see GetClientInfo)*/
  615. /*    kCSMemoryClient                    = 0x0001,*/
  616. /*    kCSIOClient                        = 0x0004,*/
  617. /*    kCSShareableCardInsertEvents    = 0x0008,*/
  618. /*    kCSExclusiveCardInsertEvents    = 0x0010*/
  619. /*----------------        CSReleaseConfiguration            ----------------*/
  620. typedef struct ReleaseConfigurationPB ReleaseConfigurationPB;
  621.  
  622. struct ReleaseConfigurationPB {
  623.     UInt32                            clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  624.     UInt16                            socket;                        /*  -> */
  625. };
  626. /*----------------        CSResetCard                        ----------------*/
  627. typedef struct ResetCardPB ResetCardPB;
  628.  
  629. struct ResetCardPB {
  630.     UInt32                            clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  631.     UInt16                            socket;                        /*  -> */
  632.     UInt16                            attributes;                    /*  -> xxx*/
  633. };
  634. /*----------------        CSValidateCIS                    ----------------*/
  635. typedef struct ValidateCISPB ValidateCISPB;
  636.  
  637. struct ValidateCISPB {
  638.     UInt16                            socket;                        /*  -> */
  639.     UInt16                            chains;                        /*  -> whether link/null tuples should be included*/
  640. };
  641. /*----------------        CSVendorSpecific                ----------------*/
  642. typedef struct VendorSpecificPB VendorSpecificPB;
  643.  
  644. struct VendorSpecificPB {
  645.     UInt32                            clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  646.     UInt16                            vsCode;
  647.     UInt16                            socket;
  648.     UInt32                            dataLen;                    /*  -> length of buffer pointed to by vsDataPtr*/
  649.     UInt8                            *vsDataPtr;                    /*  -> Card Services version this client expects*/
  650. };
  651. /*    ‘vsCode’ field values*/
  652.  
  653. enum {
  654.     vsAppleReserved                = 0x0000,
  655.     vsEjectCard                    = 0x0001,
  656.     vsGetCardInfo                = 0x0002,
  657.     vsEnableSocketEvents        = 0x0003,
  658.     vsGetCardLocationIcon        = 0x0004,
  659.     vsGetCardLocationText        = 0x0005,
  660.     vsGetAdapterInfo            = 0x0006
  661. };
  662.  
  663. /*****************************************************************************************/
  664. /**/
  665. /*    GetAdapterInfo parameter block (vendor-specific call #6)*/
  666. typedef struct GetAdapterInfoPB GetAdapterInfoPB;
  667.  
  668. struct GetAdapterInfoPB {
  669.     UInt32                            attributes;                    /* <-  capabilties of socket's adapter*/
  670.     UInt16                            revision;                    /* <-  id of adapter*/
  671.     UInt16                            reserved;                    /* */
  672.     UInt16                            numVoltEntries;                /* <-  number of valid voltage values*/
  673.     UInt8                            *voltages;                    /* <-> array of BCD voltage values*/
  674. };
  675. /*    ‘attributes’ field values*/
  676.  
  677. enum {
  678.     kCSLevelModeInterrupts        = 0x00000001,
  679.     kCSPulseModeInterrupts        = 0x00000002,
  680.     kCSProgrammableWindowAddr    = 0x00000004,
  681.     kCSProgrammableWindowSize    = 0x00000008,
  682.     kCSSocketSleepPower            = 0x00000010,
  683.     kCSSoftwareEject            = 0x00000020,
  684.     kCSLockableSocket            = 0x00000040,
  685.     kCSInUseIndicator            = 0x00000080
  686. };
  687.  
  688. /*****************************************************************************************/
  689. /**/
  690. /*    GetCardInfo parameter block (vendor-specific call #2)*/
  691. typedef struct GetCardInfoPB GetCardInfoPB;
  692.  
  693. struct GetCardInfoPB {
  694.     UInt8                            cardType;                    /* <-  type of card in this socket (defined at top of file)*/
  695.     UInt8                            subType;                    /* <-  more detailed card type (defined at top of file)*/
  696.     UInt16                            reserved;                    /* <-> reserved (should be set to zero)*/
  697.     UInt16                            cardNameLen;                /*  -> maximum length of card name to be returned*/
  698.     UInt16                            vendorNameLen;                /*  -> maximum length of vendor name to be returned*/
  699.     UInt8                            *cardName;                    /*  -> pointer to card name string (read from CIS), or nil*/
  700.     UInt8                            *vendorName;                /*  -> pointer to vendor name string (read from CIS), or nil*/
  701. };
  702. /*    GetCardInfo card types*/
  703.  
  704. enum {
  705.     kCSUnknownCardType            = 0,
  706.     kCSMultiFunctionCardType    = 1,
  707.     kCSMemoryCardType            = 2,
  708.     kCSSerialPortCardType        = 3,
  709.     kCSSerialOnlyType            = 0,
  710.     kCSDataModemType            = 1,
  711.     kCSFaxModemType                = 2,
  712.     kCSFaxAndDataModemMask        = (kCSDataModemType | kCSFaxModemType),
  713.     kCSVoiceEncodingType        = 4,
  714.     kCSParallelPortCardType        = 4,
  715.     kCSFixedDiskCardType        = 5,
  716.     kCSUnknownFixedDiskType        = 0,
  717.     kCSATAInterface                = 1,
  718.     kCSRotatingDevice            = (0 << 7),
  719.     kCSSiliconDevice            = (1 << 7),
  720.     kCSVideoAdaptorCardType        = 6,
  721.     kCSNetworkAdaptorCardType    = 7,
  722.     kCSAIMSCardType                = 8,
  723.     kCSNumCardTypes                = 9
  724. };
  725.  
  726. extern pascal OSErr CSVendorSpecific(VendorSpecificPB *pb)
  727.  TWOWORDINLINE(0x7000, 0xAAF0);
  728. extern pascal OSErr CSRegisterClient(RegisterClientPB *pb)
  729.  TWOWORDINLINE(0x7001, 0xAAF0);
  730. extern pascal OSErr CSDeregisterClient(RegisterClientPB *pb)
  731.  TWOWORDINLINE(0x7002, 0xAAF0);
  732. extern pascal OSErr CSGetFirstTuple(GetTuplePB *pb)
  733.  TWOWORDINLINE(0x7003, 0xAAF0);
  734. extern pascal OSErr CSGetNextTuple(GetTuplePB *pb)
  735.  TWOWORDINLINE(0x7004, 0xAAF0);
  736. extern pascal OSErr CSGetTupleData(GetTuplePB *pb)
  737.  TWOWORDINLINE(0x7005, 0xAAF0);
  738. extern pascal OSErr CSGetConfigurationInfo(GetModRequestConfigInfoPB *pb)
  739.  TWOWORDINLINE(0x7006, 0xAAF0);
  740. extern pascal OSErr CSGetCardServicesInfo(GetCardServicesInfoPB *pb)
  741.  TWOWORDINLINE(0x7007, 0xAAF0);
  742. extern pascal OSErr CSGetStatus(GetStatusPB *pb)
  743.  TWOWORDINLINE(0x7008, 0xAAF0);
  744. extern pascal OSErr CSValidateCIS(ValidateCISPB *pb)
  745.  TWOWORDINLINE(0x7009, 0xAAF0);
  746. extern pascal OSErr CSGetFirstClient(GetClientPB *pb)
  747.  TWOWORDINLINE(0x700F, 0xAAF0);
  748. extern pascal OSErr CSGetNextClient(GetClientPB *pb)
  749.  TWOWORDINLINE(0x7010, 0xAAF0);
  750. extern pascal OSErr CSGetClientInfo(GetClientInfoPB *pb)
  751.  TWOWORDINLINE(0x7011, 0xAAF0);
  752. extern pascal OSErr CSResetCard(ResetCardPB *pb)
  753.  TWOWORDINLINE(0x7012, 0xAAF0);
  754. extern pascal OSErr CSRequestWindow(ReqModRelWindowPB *pb)
  755.  TWOWORDINLINE(0x7013, 0xAAF0);
  756. extern pascal OSErr CSModifyWindow(ReqModRelWindowPB *pb)
  757.  TWOWORDINLINE(0x7014, 0xAAF0);
  758. extern pascal OSErr CSReleaseWindow(ReqModRelWindowPB *pb)
  759.  TWOWORDINLINE(0x7015, 0xAAF0);
  760. extern pascal OSErr CSRequestConfiguration(GetModRequestConfigInfoPB *pb)
  761.  TWOWORDINLINE(0x701B, 0xAAF0);
  762. extern pascal OSErr CSModifyConfiguration(GetModRequestConfigInfoPB *pb)
  763.  TWOWORDINLINE(0x701C, 0xAAF0);
  764. extern pascal OSErr CSAccessConfigurationRegister(AccessConfigurationRegisterPB *pb)
  765.  TWOWORDINLINE(0x701D, 0xAAF0);
  766. extern pascal OSErr CSReleaseConfiguration(ReleaseConfigurationPB *pb)
  767.  TWOWORDINLINE(0x701E, 0xAAF0);
  768. extern pascal OSErr CSGetClientEventMask(GetSetClientEventMaskPB *pb)
  769.  TWOWORDINLINE(0x701F, 0xAAF0);
  770. extern pascal OSErr CSSetClientEventMask(GetSetClientEventMaskPB *pb)
  771.  TWOWORDINLINE(0x7020, 0xAAF0);
  772. extern pascal OSErr CSRequestSocketMask(ReqRelSocketMaskPB *pb)
  773.  TWOWORDINLINE(0x7021, 0xAAF0);
  774. extern pascal OSErr CSReleaseSocketMask(ReqRelSocketMaskPB *pb)
  775.  TWOWORDINLINE(0x7022, 0xAAF0);
  776.  
  777. #if PRAGMA_IMPORT_SUPPORTED
  778. #pragma import off
  779. #endif
  780.  
  781. #if PRAGMA_ALIGN_SUPPORTED
  782. #pragma options align=reset
  783. #endif
  784.  
  785. #ifdef __cplusplus
  786. }
  787. #endif
  788.  
  789. #endif /* __CARDSERVICES__ */
  790.